﻿using System;
using System.Collections.Generic;
using System.Linq;
using DomainModel;
using Repository.Abstract;
using Services.Abstract;

namespace Services.Concrete
{
    public class LessonService : Service<Lesson>, ILessonService
    {
        private readonly ILessonRepository _lessonRepository;

        public LessonService(ILessonRepository lessonRepository)
            : base(lessonRepository)
        {
            _lessonRepository = lessonRepository;
        }

        public List<Lesson> Get(DateTime date, Timetable timetable)
        {
            if (timetable == null)
                throw new ArgumentNullException("timetable");

            return (List<Lesson>)_lessonRepository.GetLessonByDateAndTimetable(date, timetable);
        }

        public List<Lesson> Get(User student)
        {
            if (student == null)
                throw new ArgumentNullException("student");

            if (!student.Roles.Contains(Role.Student))
                return null;

            return (List<Lesson>)_lessonRepository.GetLessonsByStudent(student);

            throw new NotImplementedException();
        }
    }
}